package  
{
	import com.zheng.russiaRec.controller.initGame.C_StartOver;
	import com.zheng.russiaRec.controller.initGame.C_StartUp;
	import org.puremvc.as3.interfaces.IFacade;
	import org.puremvc.as3.patterns.facade.Facade;
	
	/**
	 * 单例模式类
	 * @author Mr.zheng
	 */
	public class ApplicationFacade extends Facade implements IFacade
	{
		public static const START_UP:String = "start_up";
		public static const START_OVER:String = "start_over";
		
		private static var _instance:ApplicationFacade = null;
		/**
		 * 构造
		 */
		public function ApplicationFacade(single:Single)
		{
			if(single == null)
			{
				throw new Error("Can't create instance , Single is Null!");
			}
		}
		
		/**
		 * 单例引用
		 */
		public static function get instance():ApplicationFacade
		{
			if(_instance == null)
			{
				_instance = new ApplicationFacade(new Single());
			}
			return _instance;
		}
		
		override protected function initializeController():void 
		{
			super.initializeController();
			registerCommand(START_UP, C_StartUp);
			registerCommand(START_OVER, C_StartOver);
		}
		public function startup(app:Object):void 
		{
			sendNotification(START_UP,app);
		}
	}
}
class Single{}